<?php
namespace Home\Controller;
use Think\Controller;
Class CommonController extends Controller{
	protected $userInfo = false; //用户登录信息
	//构造方法
	public function __construct(){
		parent::__construct();
		//登录检查
		$this->checkUser();
	}

	//方法实现
	private function checkUser(){
		if (session('?userId')) {
			$userinfo = array(
			        'userId'=>session('userId'), //登录用户id
			        'userName'=>session('userName'),  //昵称
			);
			$this->userInfo = $userinfo;   //把登录用户的信息储存在变量$userInfo == Json
			$this->assign($userinfo);
		}
	}


	public function password($pwd){
		return  substr(md5(sha1(md5($pwd).'fee').'f342g'),2,47);
	}
}
?>